<?php
@session_start();
$PurviewLevel=2;
$CheckChannelID=1;  
$PurviewLevel_Others="user_app_user";

require("../../inc/common.inc.php");
require_once("../Admin_ChkPurview.php");
$grouparr="";
$rs=$db->excu("select * from mx_app_user_group order by orderid asc,id asc");
if ($db->num_rows($rs)>0){
	while ($rsdb=$db->fetch_array($rs)){
		$grouparr[$rsdb["id"]]=$rsdb["groupname"];
	}
}
if(!isset($_COOKIE["appusers"])){
	setcookie("appusers","",time()+3600,"/");
	setcookie("appusersnum","0",time()+3600,"/");
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<TITLE>铭讯EOS网站后台管理</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<Meta name="Keywords" Content="济南网站建设 济南网站制作 山东网站建设 济南铭讯软件有限公司">
<Meta name="Description" Content="济南网站制作：铭讯软件专业服务优秀企业，致力于网站建、设网站推广、网络营销一体的全访位网络服务商">
<link rel="stylesheet" href="../images/style.css" type="text/css">
<script>
var P = window.parent, D = P.loadinndlg();   // 注意！这行代码是每个内容页必须加的内容，否则无法正确显示。
</script>
<SCRIPT LANGUAGE="JavaScript">
function ConfirmDel()
{
   if(confirm("确定要删除选中的信息吗？"))
     return true;
   else
     return false;
	 
}
function postdo(va){
	document.form2.jobs.value=va
	document.form2.submit();
}
function selectradio(radioid){
	if(document.getElementById("checkid"+radioid).checked){
		document.getElementById("checkid"+radioid).checked=false;
		var appusers = GetCookie("appusers").replace(radioid+",","");
		SetCookie("appusers",appusers);
		var appusersnum = parseInt(GetCookie("appusersnum"))-1;
		if(appusersnum<0){appusersnum=0;}
		SetCookie("appusersnum",appusersnum);
		document.getElementById("showselectnum").innerHTML=appusersnum;
		window.top.main.changeselectinfo(appusersnum);
	}else{
		document.getElementById("checkid"+radioid).checked="checked";
		var appusers = GetCookie("appusers")+radioid+",";
		SetCookie("appusers",appusers);
		
		var appusersnum = parseInt(GetCookie("appusersnum"))+1;
		if(appusersnum<0){appusersnum=0;}
		SetCookie("appusersnum",appusersnum);
		document.getElementById("showselectnum").innerHTML=appusersnum;
		window.top.main.changeselectinfo(appusersnum);
	}
}
function closewind(){
	P.cancel();
}
</SCRIPT>
</head>
<body> 
<?php
$appusersstr = "";
$appusersnum = 0;
if(isset($_COOKIE["appusers"])){
$appusersstr = ",".$_COOKIE["appusers"];
$appusersnum = $_COOKIE["appusersnum"];
}

  $s="T=$T&";
  $str=" and isok=1 ";

  if ($username!=""){
    $str.=" and username like '%$username%' ";
	$s.="username=$username&";
  }
  if ($weixinid!=""){
    $str.=" and weixinid like '%$weixinid%' ";
	$s.="weixinid=$weixinid&";
  }
  if ($groupid!=""){
  	$groupid=intval($groupid);
    $str.=" and groupid='$groupid' ";
	$s.="groupid=$groupid&";
  }
  if ($mobile!=""){
    $str.=" and mobile like '%$mobile%' ";
	$s.="mobile=$mobile&";
  }
  if ($isok!=""){
  	$isok=intval($isok);
    $str.=" and isok='$isok' ";
	$s.="isok=$isok&";
  }
  if ($sex!=""){
  	$sex=intval($sex);
    $str.=" and sex='$sex' ";
	$s.="sex=$sex&";
  }

  
  if ($T=="isok"){
    $str.=" and isok='1' ";
  }
  elseif ($T=="noisok"){
    $str.=" and isok='0' ";
  }

  if(empty($pageindex)){
      $pageindex=1;
  }
  $pagesize=intval($pagesize);
  if ($pagesize==0){
  	$pagesize=5;
  }

  $table=" mx_app_user ";
  $order=" order by id desc";
  $column=" * ";
  $biaoid="id";
  $c=$db->listcount($table,$str);

  $list=$db->list1($pageindex,$pagesize,$table,$column,$str,$order,$biaoid);
 ?>
<div class="xm2_b" style="border-bottom:0px;">

<div class="t">
<div class="height10"></div>
<table border="0" cellpadding="0" cellspacing="1" class="search_from" style="padding-left:20px;">
<form name="searchform1" id="searchform1" action="tuisong_app_user.php" method="post">
 <tr>
   <td>&nbsp;微信：</td><td><input name="weixinid" type="text" id="weixinid" value="" size="10" class="search_input"/></td>
   <td>&nbsp;手机：</td><td><input name="mobile" type="text" id="mobile" value="" size="10" class="search_input"/></td>
   <td>&nbsp;分组：</td><td>&nbsp;
   <select name="groupid"><option value="">不限</option><?php echo show_select($grouparr,"");?></select>
   </td>
   <td>&nbsp;<select name="sex"><option value="">不限</option><option value="1">男</option><option value="0">女</option></select></td>
  <td>&nbsp;<input type="submit" name="Submit3" value="搜索" class="button2" /></td>
  <td>&nbsp;<strong>已选择 <b id="showselectnum"><?php echo $appusersnum;?></b>人</strong></td>
  </tr>
</form>
</table>
</div>
<div class="height10"></div>
</div>

<div class="xm2_b">
<table width="100%" border="0"  cellspacing="1" cellpadding="8" class="table_southidc">
  <tr align="center"> 
    <th width="5%">选择</th>
    <th width="12%">加入时间</th>
    <th width="15%">手机号</th>
    <th width="12%">所属分组</th>
    <th width="10%">活跃度(%)</th>
    <th width="12%">最后登陆</th>
  </tr>
  <form name="form1" id="form1" method="post" action="app_user.php">
  <?PHp
		if (!is_array($list) or $c==0){
			echo "<tr class=\"list1\"><td colspan=8><center>暂无信息</center></td></tr>";
		}else{
			for($i=0;$i<count($list);$i++){
  ?>
  <tr class="list" align="center" onclick="selectradio(<?php echo $list[$i]["id"] ?>)"> 
    <td width="5%"><div style="position:relative; width:100%; height:100%;"><input type="checkbox" name="id[<?php echo $list[$i]["id"] ?>]" id="checkid<?php echo $list[$i]["id"] ?>" value="<?php echo $list[$i]["id"] ?>" class="input_check" <?php echo strpos($appusersstr,",".$list[$i]["id"].",")===false?"":"checked='checked'";?>><div style="width:100%; height:100%; position: absolute; z-index:99; border:1px solid #F00; top:0px; left:0px; background:#CCC;filter:alpha(opacity=0);-moz-opacity:0;-khtml-opacity: 0;opacity: 0;">&nbsp;</div></div></td>
	<td><?php echo formatdate($list[$i]["regdate"]);?></td>
    <td><?php echo $list[$i]["mobile"]==""?"未知":$list[$i]["mobile"] ?></td>
    <td><?php echo $list[$i]["groupid"]==0?"未分组":$grouparr[$list[$i]["groupid"]]?></td>
    <td><?php echo (float)$list[$i]["huoyue"] ?></td>
	<td><?php echo $list[$i]["lastlogintime"]==""?"未知":formatdate($list[$i]["lastlogintime"]);?></td>
  </tr>
  <?PHP
			}
  ?>
  <?php }?>
  <input type="hidden" name="actions" id="actions" value="delall">
  </form>
</table>
<?php if ($c>0){?>
	<div class="height15"></div>
	
	<div class="clear"></div>
<?php }
if ($c>$pagesize){
?>
	<div class="pagination">
	<?PHP
	echo $db->ThePage_mxsoft($s,$pageindex,$c,$pagesize)
	?>
	</div>
<?php 
  }

?>
<div class="clear"></div>
<div style="height:30px; text-align:center;"><input type="button" class="button" name="button" id="button" value="确认" onclick="closewind();" />&nbsp;&nbsp;<input type="button" class="button2" name="button2" id="button2" value="清空" onclick="DelCookie('appusers');DelCookie('appusersnum');window.top.main.changeselectinfo(0);window.location=window.location;" /></div>
<div class="height10"></div>
<div class="clear"></div>
<script type="text/javascript" src="/mxsoft/js/jquerys-1.5.1.js"></script>
<script type="text/javascript" src="/mxsoft/js/cookie.js"></script>
<script language="javascript">
$(document).ready(function(){  
	$(".table_southidc tr").mouseover(function(){   
	$(this).addClass("list2");}).mouseout(function(){   
	$(this).removeClass("list2");}) //移除该行的class   
	$(".table_southidc tr:even").addClass("list1");   
});   
</script> 

<script language="javascript">
function postdo(va){
	document.form1.actions.value=va;
	document.form1.submit();
}
</script>
</div>
</body>
</html>
